package com.levy.contronller.javase.designModel.builder;

/**
 * 建造者模式
 *为了对象的创建
 * 关注对象创建的各个部分的创建过程
 * Created by levy on 2018/8/7.
 */
public class MainClass {

    public static void main(String[] args) {
        //客户直接建房子
        House house = new House();
        house.setFloor("地板");
        house.setWall("墙体");
        house.setHouseTop("屋顶");
        System.out.println("自己修房子"+house);


        //喊来工程队
        HouseBuilder hb = new PingFangBuilder();
        //工程队开始修
        hb.makeFloor();
        hb.makeWall();
        hb.makeHouseTop();
        //工程队修完
        House pf = hb.getHouse();
        System.out.println("平房修理完成");
        System.out.println(pf);


        //找设计师来做
//        HouseBuilder hb1 = new PingFangBuilder();
//        HouseDicrector hd = new HouseDicrector(hb1);
//        hd.makeHouse();
//        House house1 = hb.getHouse();
//        System.out.println("设计师建造平房完成");
//        System.out.println(house1);


        //修公寓
        HouseBuilder hb2 = new GongYuBuilder();
        HouseDicrector hd2 = new HouseDicrector();
        hd2.makeHouse(hb2);
        House house2 = hb2.getHouse();
        System.out.println("设计师建造公寓完成");
        System.out.println(house2);


    }
}
